{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# `==` 和 `is`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- `==` 和 `!=`比较的是对象的值 `value` 是否相等\n",
    "- `is` 和 `is not` 比较的是对象的 `id` 是否相等（比较两个对象是否是同一个对象）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = [1,2,3]\n",
    "b = [1,2,3]\n",
    "\n",
    "print(f'id(a) = {id(a)}')\n",
    "print(f'id(b) = {id(b)}')\n",
    "print(a == b)\n",
    "print(a != b)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "a = [1,2,3]\n",
    "b = [1,2,3]\n",
    "\n",
    "print(f'id(a) = {id(a)}')\n",
    "print(f'id(b) = {id(b)}')\n",
    "print(a is b)\n",
    "print(a is not b)"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "e7370f93d1d0cde622a1f8e1c04877d8463912d04d973331ad4851f04de6915a"
  },
  "kernelspec": {
   "display_name": "Python 3.9.4 64-bit",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  },
  "orig_nbformat": 2
 },
 "nbformat": 4,
 "nbformat_minor": 2
}